package com.itheima.spring.bestpractive.common.myResult;

/**
 * @version 1.0
 * @author: HZY
 * @date: 2025/6/19 20:16
 * @Content: 针对系统错误的枚举
 */

public enum REnum {
    SUCCESS(200, "请求成功"),

    // ========== 通用失败 ==========
    FAIL(400, "请求失败"),
    UNAUTHORIZED(401, "未认证"),
    FORBIDDEN(403, "无权限访问"),
    NOT_FOUND(404, "资源未找到"),
    METHOD_NOT_ALLOWED(405, "请求方法不支持"),
    SERVER_ERROR(500, "服务器内部错误"),
    SERVER_SQL_ERROR(5001, "服务器内部数据错误"),

    // ========== 参数错误 ==========
    PARAM_ERROR(1000, "参数错误"),
    PARAM_MISSING(1001, "缺少必要参数"),
    PARAM_TYPE_ERROR(1002, "参数类型错误");

    private final int code;
    private final String message;

    REnum(int code , String message) {
        this.code = code;
        this.message = message;
    }
    public int getCode() {
        return code;
    }
    public String getMessage() {
        return message;
    }
}
